<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let obj = {
            name: "twj"
        }
        let registry = new FinalizationRegistry(data => {
            console.log("销毁了", data)
        })
        registry.register(obj, "11111111111111")
        //registry.unregister(obj) //取消注册
        obj = null //销毁了 11111111111111

    </script>
</body>

</html>